import { request } from '../request';

export function commentList(params: { articleId: string } & Api.PageParam) {
  return request<Api.PageVO<Api.CommentVO>>({
    url: '/comment/list',
    method: 'post',
    data: params,
  });
}

export function commentReply(params: { parentId: string } & Api.PageParam) {
  return request<Api.PageVO<Api.CommentVO>>({
    url: '/comment/reply',
    method: 'post',
    data: params,
  });
}

export function commentDel(params: { id: string }) {
  return request<number>({
    url: '/comment/del',
    method: 'post',
    data: params,
  });
}
export function commentLiked(params: { commentId: string }) {
  return request<boolean>({
    url: '/comment/liked',
    method: 'post',
    data: params,
  });
}

export function commentReport(params: { commentId: string; remark: string }) {
  return request<boolean>({
    url: '/comment/report',
    method: 'post',
    data: params,
  });
}

export function commentAdd(params: {
  articleId: string;
  content: string;
  parentId: string;
  replyId: string;
}) {
  return request<Api.CommentVO>({
    url: '/comment/add',
    method: 'post',
    data: params,
  });
}
